@include('admin.public.head')
@include('admin.public.pop')

<style type="text/css">

    .inner_btn {
        background: #19a97b;
        color: white;
        padding: 5px 8px;
        border-radius: 2px;
    }
</style>

<div class="ibox-title">
    <h5>课程管理</h5>
</div>

<div class="ibox-content">
    <div class="row">
        <div class="col-sm-12 clear">
            <div class="" style="margin: 0 10px">
                <a href="/home" class="btn btn-w-m btn-primary">返回课程表</a>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12 pull-right m-b-xs">
            <form action="">
                <div class="col-sm-1  m-b-xs text-center pull-right">
                    <button type="submit" class="btn btn-sm btn-primary">搜索</button> </span>
                </div>

                @include('admin.public.store.where_select')

                @include('admin.public.class_base_info.where_classroom_teacher_classbase')

                @include('admin.public.class_base_time.where_week_select')

                @include('admin.public.class_base_info.where_user_rank')

            </form>
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>等级名称</th>
            <th>課程名稱</th>
            <th>老師名稱</th>
            <th>課室編號</th>
            <th>上課時間</th>
            <th>上課時長(小時)</th>
            <th>可容納上課人數</th>
            <th>門店名稱</th>
            <th>签到二维码</th>
        </tr>
        </thead>

        <tbody>
        @foreach ($result as $v)
            <tr>
                <td>{{$v->id??''}}</td>
                <td>
                    <select class="form-control class_base_info_edit_level" name="user_rank_id"  class_base_info_id="{{$v->id??''}}">
                        <option value="">请选择等级</option>
                        @foreach($user_rank as $kk=>$vv)
                            <option value="{{$vv->id}}" @if(!empty($v->user_rank->id)) @if($v->user_rank->id == $vv->id) selected="selected" @endif @endif>{{$vv->rank_name}}</option>
                        @endforeach
                    </select>
                </td>
                <td>{{$v->class_base->class_name??''}}</td>
                <td>{{$v->teacher->teacher_name??''}}</td>
                <td>{{$v->classsroom->numbering??''}}</td>
                <td>
                    周期：{{$v->class_week}}</br>
                    上課時間：{{$v->class_time}}</br>
                </td>
                <td>{{$v->class_duration}}</td>
                <td>{{$v->class_number_people}}</td>
                <td>{{$v->store->store_name}}</td>
                <td><img src="{{$v->liantu_qr}}" width="300" height="150" /></td>
            </tr>
        @endforeach
        </tbody>
        {{ $result->appends(Request::except('page'))->links() }}
    </table>
    {{ $result->appends(Request::except('page'))->links() }}
</div>
<script>
    $(".class_base_info_edit_level").change(function(){
            var user_rank_id = $(this).val();
            var class_base_info_id = $(this).attr('class_base_info_id');

            $.ajax({
                type: "post",
                url: "/class_base_info_edit_level",
                data : {'class_base_info_id':class_base_info_id,'user_rank_id':user_rank_id},
                dataType: "json",
                success: function(data) {


                }
            });
    });
</script>
